package com.woniu.supermarket.web;

import com.github.pagehelper.PageInfo;
import com.woniu.supermarket.entity.PurchaseCheck;
import com.woniu.supermarket.entity.Stock;
import com.woniu.supermarket.result.ResultResponse;
import com.woniu.supermarket.service.IPurchaseCheckService;
import com.woniu.supermarket.service.IStockService;
import com.woniu.supermarket.vo.StockVo;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@RestController
@RequestMapping("purchasecheck")
public class PurchaseCheckController {
    @Autowired
    IPurchaseCheckService purchaseCheckService;


    @GetMapping("/findPurchaseCheckBypurchaseNumber/{purchaseNumber}")
    @ApiOperation(value = "查询审核信息操作")
    public ResultResponse<List<PurchaseCheck>> findPurchaseCheckBypurchaseNumber(@ApiParam(name="purchaseNumber",value = "采购订单编号")@PathVariable(name = "purchaseNumber") String purchaseNumber){
        ResultResponse<List<PurchaseCheck>> result = null;
        try {
            List<PurchaseCheck> list = purchaseCheckService.queryOneByPurchaseNumber(purchaseNumber);
            if(list != null){
                result = new ResultResponse<>(200,"查询审核信息成功",list);
            }else {
                result = new ResultResponse<>(201,"查询审核信息失败");
            }
        }catch (RuntimeException e){
            e.printStackTrace();
            result = new ResultResponse<>(201,"系统错误");
        }
        return result;
    }

}
